<%-- 
    Document   : inc_secretary_form_report
    Created on : Jan 13, 2013, 11:23:30 PM
    Author     : matt
--%>

<%@page import="com.gestionabsences.form.FormSecretaryJustification"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<c:if test="${ empty resultatQueryListAbsences && empty resultatQueryAbsenceEtudiant }">
    <label for="">Etudiant</label>
    <select name="<% out.print(FormSecretaryJustification.CHAMP_STUDENT);%>" id="<% out.print(FormSecretaryJustification.CHAMP_STUDENT);%>">
	<c:forEach items="${ sessionScope.listeEtudiantsAbsents }" var="mapListeEtudiants" varStatus="boucle">
	    <option value="${ mapListeEtudiants.key }">${ mapListeEtudiants.value }</option>
	</c:forEach>
    </select>

    <input class="btn btn-primary" type="submit" value="Afficher la liste des absences" />

    <c:if test="${ !empty formJustification.erreurs['erreur'] }">
	<p class="help-inline">${formJustification.erreurs['erreur']}</p>
    </c:if>
    <c:if test="${ !empty formJustification.erreurs['etudiant'] }">
	<p class="help-inline">${formJustification.erreurs['etudiant']}</p>
    </c:if>
</c:if>

<c:if test="${ !empty resultatQueryListAbsences }">
    <fieldset>
	<legend>Liste des absences de ${ formJustificationChoixEtudiant.formerValEtudiantAbsent }</legend>

	<input type="hidden" name="<% out.print(FormSecretaryJustification.CHAMP_ETUDIANT_SPECIFIE);%>" value="${ formJustificationChoixEtudiant.formerValEtudiantAbsent }">

	<table class="table table-striped">
	    <c:forEach items="${ resultatQueryListAbsences.columnsName }" var="nomColonne" varStatus="boucle">
		<th>${ nomColonne }</th>
	    </c:forEach>
	    <th></th>
	    </tr>
	    <c:set var="count" value="0" scope="page" />
	    <c:forEach items="${ resultatQueryListAbsences.tuples }" var="listTuples" varStatus="boucle">
		<tr>
		    <c:forEach items="${ listTuples.line }" var="listLine" varStatus="boucle">
			<td>${ listLine }</td>
		    </c:forEach>
		    <td>
			<input type="hidden" name="<% out.print(FormSecretaryJustification.CHAMP_ID_SEANCE);%>${ count }" value="${ listTuples.line[0] }">
			<input type="hidden" name="<% out.print(FormSecretaryJustification.CHAMP_ID_MATIERE);%>${ count }" value="${ listTuples.line[1] }">
			<input type="hidden" name="<% out.print(FormSecretaryJustification.CHAMP_ISA);%>${ count }" value="${ listTuples.line[2] }">
			<input type="radio" name="<% out.print(FormSecretaryJustification.CHAMP_NUM_TUPLE);%>" value="${ count }">
		    </td>
		</tr>
		<c:set var="count" value="${count + 1}" scope="page"/>
	    </c:forEach>
	</table>

	<c:if test="${ !empty formJustification.erreurs['erreur'] }">
	    <p class="help-inline">${formJustification.erreurs['erreur']}</p>
	</c:if>

    </fieldset>
    <input class="btn btn-primary" type="submit" value="Modifier"  />
</c:if>

<c:if test="${ !empty resultatQueryAbsenceEtudiant }">
    <fieldset>
	<legend>Modification de la justification et la crédibilité</legend>

	<c:forEach items="${ resultatQueryAbsenceEtudiant.tuples }" var="listTuples" varStatus="boucle">
	    <blockquote>
		<p>Justification actuelle : <em>${ listTuples.line[0] }</em></p>
		<p>Crédibilité actuelle : ${ listTuples.line[1] } / 3</p>
	    </blockquote>
	    <textarea name="<% out.print(FormSecretaryJustification.CHAMP_JUSTIFICATION);%>" rows="10" cols="50">${ listTuples.line[0] }</textarea>
	</c:forEach>

	<input type="hidden" name="<% out.print(FormSecretaryJustification.CHAMP_ETUDIANT_SPECIFIE);%>" value="${ formJustificationChoixAbsence.formerValEtudiantAbsent }">
	<input type="hidden" name="<% out.print(FormSecretaryJustification.CHAMP_ID_SEANCE_SPECIFIE);%>" value="${ formJustificationChoixAbsence.formerValIDSeance }">
	<input type="hidden" name="<% out.print(FormSecretaryJustification.CHAMP_ID_MATIERE_SPECIFIE);%>" value="${ formJustificationChoixAbsence.formerValIDMatiere }">
	<input type="hidden" name="<% out.print(FormSecretaryJustification.CHAMP_ISA_SPECIFIE);%>" value="${ formJustificationChoixAbsence.formerValTypeSeance }">

	<label for="<% out.print(FormSecretaryJustification.CHAMP_CREDIBILITE);%>">Crédibilité ( entre 0 et 3)</label>
	<input type="number" name="<% out.print(FormSecretaryJustification.CHAMP_CREDIBILITE);%>" id="<% out.print(FormSecretaryJustification.CHAMP_CREDIBILITE);%>" min="0" max="3" step="1" style="text-align:center;" />

	<c:if test="${ !empty formJustification.erreurs['erreur'] }">
	    <p class="help-inline">${formJustification.erreurs['erreur']}</p>
	</c:if>

    </fieldset>
    <input class="btn btn-primary" type="submit" value="Modifier l'absence"  />
</c:if> 


<c:if test="${ !empty formJustification }">
    <p>${ formJustification.erreurs['erreur'] }</p>
</c:if>